import {View, Text} from '@tarojs/components'
import {onAppShow, useDidShow} from '@tarojs/taro'
import {useState, useEffect} from 'react'


const NavAside = ({setstate, classify1}) => {
  const [navIndex, setNavIndex] = useState(0)


  // 当切换导航列时
  const changeIndex = (i, name, id) => {
    setNavIndex(i)
    setstate(`goods${id}`)
  }


  return (
    <View className='navAside'>
      {classify1.map((v, i) => (<Text key={v.id} className={[navIndex === i ? 'active' : '', 'tip']} onClick={() => changeIndex(i, v.name, v.id)}>{v.name}</Text>))}
    </View>
  )
}

export default NavAside
